package cn.lls.base.common;

import lombok.Getter;

import java.util.Objects;

/**
 * 枚举常量
 *
 * @ClassName LlsEnum
 * @Author 划水艺术家
 * @Date 2022/11/19 23:47
 * @Version 1.0
 **/
public class LlsEnum {

    /*
        六六顺的三大身份
        SUPER_ADMIN 超级管理员,
        COMPANY_ADMIN 单位管理员,
        EMPLOYEE 公司员工
     */
    @Getter
    public enum LlsIdentify {

        SUPER_ADMIN("sa"), COMPANY_ADMIN("ca"), EMPLOYEE("emp");
        private final String identify;
        LlsIdentify(String identify) {
            this.identify = identify;
        }
    }

    /*
        六六顺的公司三大状态
        UNDER_REVIEW 审核中
        REFUSE 拒绝
        ACTIVE 活动中
        BANNED 封禁中
     */
    @Getter
    public enum LlsCompanyStatus {

        UNDER_REVIEW(0), REFUSE(1), ACTIVE(2), BANNED(3),
        // BLANK 不代表人任何状态，为了便于处理条件查询公司的字段罢了
        BLANK(-1)
        ;

        private final Integer status;
        LlsCompanyStatus(Integer status) {
            this.status = status;
        }
    }


    /*
        审核公司的4种行为枚举类型
        REFUSE 拒绝
        AGREE 同意
        BANNED 封禁
        UNBLOCK 解封
     */
    @Getter
    public enum LlsAuditCompanyBehavior {
        REFUSE(1), AGREE(2), BANNED(3), UNBLOCK(4),
        ;
        private final Integer behavior;
        LlsAuditCompanyBehavior(Integer behavior) {
            this.behavior = behavior;
        }
    }

    /*
        审核公司的4种行为对应行为后的状态转化
     */
    public static Integer behavior2Status(Integer behavior){
        if (Objects.equals(behavior, LlsAuditCompanyBehavior.REFUSE.getBehavior()))
            return LlsCompanyStatus.REFUSE.getStatus();
        if (Objects.equals(behavior, LlsAuditCompanyBehavior.BANNED.getBehavior()))
            return LlsCompanyStatus.BANNED.getStatus();
        if (Objects.equals(behavior, LlsAuditCompanyBehavior.AGREE.getBehavior()) || Objects.equals(behavior, LlsAuditCompanyBehavior.UNBLOCK.getBehavior()))
            return LlsCompanyStatus.ACTIVE.getStatus();
        return 0;
    }


}
